<template>
	<el-container>
		<el-main class='x-main-edit'>
			<el-form ref="form" :rules="form_rules" :model="form" size="mini" label-width="15%">
				<el-tabs type="border-card" v-model="page_tag">
					<!---->
					<!---->
					<el-tab-pane :label="page_info.title" name="1">
						<el-form-item label="常见问题">
							<Tinymce menubar="" v-model="form.problem" :height="350" ref="problem"></Tinymce>
						</el-form-item>
						<el-form-item label="计费规则">
							<Tinymce menubar="" v-model="form.charge_rules" :height="350" ref="about"></Tinymce>
						</el-form-item>
						<el-form-item label="下单流程">
							<Tinymce menubar="" v-model="form.order_step" :height="350" ref="order_step"></Tinymce>
						</el-form-item>
						<el-form-item label="违章处理">
							<Tinymce menubar="" v-model="form.violation" :height="350" ref="violation"></Tinymce>
						</el-form-item>
						<el-form-item label="事故处理">
							<Tinymce menubar="" v-model="form.accident" :height="350" ref="accident"></Tinymce>
						</el-form-item>
						<el-form-item label="紧急救援">
							<Tinymce menubar="" v-model="form.rescue" :height="350" ref="rescue"></Tinymce>
						</el-form-item>
						<el-form-item label="损坏赔偿">
							<Tinymce menubar="" v-model="form.compensate" :height="350" ref="compensate"></Tinymce>
						</el-form-item>
						<el-form-item label="关于我们">
							<Tinymce menubar="" v-model="form.about" :height="350" ref="about"></Tinymce>
						</el-form-item>
					</el-tab-pane>
					<!---->
					<!---->
					<el-tab-pane v-if="false" label="模板" name="2">
						<el-form-item label="应用模板" prop="reply_app_file" ref="reply_app_file">
							<el-col :span="6">
								<el-input v-model="form.reply_app_file" placeholder="默认：t_001"/>
							</el-col>
						</el-form-item>
					</el-tab-pane>
					<!---->
					<!---->
				</el-tabs>
				<!---->
				<!---->
			</el-form>
			<!---->
			<!---->
			<!-- 按钮部分 -->
			<div class="save_wrap">
				<!--				<el-button @click="funcTest" size="mini">test</el-button>-->
				<!--				<el-button @click="g_page.funcBack" size="mini">返回</el-button>-->
				<el-button type="success" @click="g_page.funcSave" size="mini">保存</el-button>
				<el-checkbox v-if="page_info.is_admin_edit" style="margin-left: 10px;" label="保存后停留" v-model="checked"/>
			</div>
			<!---->
			<!---->
			<!---->
		</el-main>
	</el-container>
</template>

<script>
	import ItemList from '@/components/CompItem/ItemList'
	import Tinymce from '@/components/Tinymce'

	export default {
		components: {
			ItemList,
			Tinymce
		},
		data() {
			let page_data = { pid: '' }
			//
			page_data = this.g_cc.funcGetInitData(page_data)
			//
			return page_data
		},
		mounted() {
			console.log('mounted', this._uid)
			console.log(this.$route.query)

			this.g_page.funcSetVue(this)
			//
			this.g_page.funcSetApiUrlEdit('/xadmin/app_car/app_car__help')
			this.g_page.funcSetApiUrlSave('/xadmin/app_car/app_car__help/save')
			let page = this
			//验证
			this.form_rules = {
				__test: [{
					required: true,
					message: '请输入原密码',
					trigger: 'blur'
				}]
			}

			let data = this.$route.query
			this.g_page.funcEdit(data)
		},
		methods: {
			funcTest() {
				console.log(this.$route.fullPath)
				// let url = `/302?callback_url=${encodeURIComponent(this.$route.fullPath)}`
				this.g_cc.func_redirect(this.$route.fullPath)
			},
			funcShowDialogAfter() {
				this.$nextTick(() => {
					// debugger
					setTimeout(() => {
						this.$refs['problem'].setContent(this.form.problem)
						this.$refs['order_step'].setContent(this.form.order_step)
						this.$refs['violation'].setContent(this.form.violation)
						this.$refs['accident'].setContent(this.form.accident)
						this.$refs['rescue'].setContent(this.form.rescue)
						this.$refs['compensate'].setContent(this.form.compensate)
						this.$refs['about'].setContent(this.form.about)
					}, 200)
				})
			},
			//保存之前
			funcSaveBefore(data) {
				console.log('funcSaveBefore', data)

				return data
			}
			////////////////
		}
	}
</script>
